<template>
  <div class="full-screen">
    <!-- <svg>
      <use xlink:href="#icon-fullscreen" />
    </svg> -->
    <!-- <svg-icon v-if="isFullScreen" icon-class="exit-fullscreen" class="fullscreen" @click="fullScreenToggle" />
    <svg-icon v-else icon-class="fullscreen" class="fullscreen" @click="fullScreenToggle" /> -->
    <svg-icon :icon-class="isFullScreen?'exit-fullscreen':'fullscreen'" class="fullscreen" @click="fullScreenToggle" />
  </div>
</template>

<script>
import ScreenFull from 'screenfull'
export default {
  data() {
    return {
      isFullScreen: false
    }
  },
  methods: {
    fullScreenToggle() {
      if (ScreenFull.isEnabled) {
        this.isFullScreen = !this.isFullScreen
        ScreenFull.toggle()
      } else {
        this.$message.info('请您升级浏览器，您的浏览器不支持全屏')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.fullscreen {
  width: 20px;
  height: 20px;
  fill: #fff;
  cursor: pointer;
}
</style>
